package com.alibaba.cloud.cargo.ui;

import com.alibaba.cloud.cargo.application.command.IncidentLoggingCmdService;
import com.alibaba.cloud.cargo.application.command.cmd.HandlingEventAddCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


/**
 * @author Administrator
 * @desc 事件处理
 */
@RestController
@RequestMapping("/event")
@RequiredArgsConstructor
public class IncidentLoginController {

    private final IncidentLoggingCmdService incidentLoggingCmdService;

    @PostMapping
    public void addHandlingEvent(@RequestBody HandlingEventAddCommand cmd) {
        cmd.setDatetime(new Date());
        incidentLoggingCmdService.addHandlingEvent(cmd);
    }

}
